﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using MyCourseManageProject.Model;

namespace MyCourseManageProject.Dal.Service
{
    /// <summary>
    /// 课程分类数据访问类
    /// </summary>
    public class CourseCategroysDal
    {
        public List<CourseCategroys> GetCourseCategories()
        {
            string sql = "select CategroyId,CategroyName from CourseCategroys";
            SqlDataReader reader = SQLHelper.GetReader(sql);
            List<CourseCategroys> clist = new List<CourseCategroys>();
            while (reader.Read())
            {
                clist.Add(new CourseCategroys
                {
                    CategroyId = Convert.ToInt32(reader["CategroyId"]),
                    CategroyName = reader["CategroyName"].ToString()

                });
            }
            reader.Close();
            return clist;
        }
    }
}
